body {
    font-family: 'Arial', sans-serif;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    margin: 0;
    background-color: #f0f2f5;
    color: #333;
    padding: 20px;
    box-sizing: border-box;
}

.container {
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    padding: 25px;
    max-width: 1200px;
    width: 100%;
    text-align: center;
    overflow: hidden;
}

h1, h2, h3, h4 {
    color: #333;
    margin-bottom: 20px;
}

.screen {
    display: none;
    width: 100%;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

.settings-panel {
    background-color: #e9eef2;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.settings-panel label {
    font-size: 1.1em;
    font-weight: bold;
    color: #555;
}

.settings-panel button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.2s ease;
}

.settings-panel button:hover {
    background-color: #0056b3;
}

.pokemon-filter-tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
}

.pokemon-filter-tabs .filter-btn {
    background-color: #f0f0f0;
    color: #333;
    border: 1px solid #ccc;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.pokemon-filter-tabs .filter-btn:hover {
    background-color: #e0e0e0;
}

.pokemon-filter-tabs .filter-btn.active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

.pokemon-filter-tabs .filter-btn.active:hover {
    background-color: #0056b3;
    border-color: #0056b3;
}

#selection-screen {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}

.pokemon-display-area {
    flex: 2;
    max-height: 600px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px;
    background-color: #f9f9f9;
}

.creation-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
}

.creation-buttons button {
    background-color: #4CAF50; /* Green */
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.2s ease;
}

.creation-buttons button:hover {
    background-color: #45a049;
}

.pokemon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    padding: 10px;
}

.pokemon-card {
    background-color: #e0eaff; /* Light blue background */
    border: 1px solid #b0c4de; /* Steel blue border */
    border-radius: 8px;
    padding: 5px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.8em;
    font-weight: bold;
    color: #333;
    text-transform: capitalize;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.pokemon-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.pokemon-card img {
    width: 60px;
    height: 60px;
    image-rendering: pixelated;
    margin-bottom: 5px;
}

.pokemon-card.selected {
    background-color: #aaddaa; /* Green for selected */
    border-color: #66aa66;
    box-shadow: 0 0 0 3px #66aa66;
}

.team-management-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 300px;
}

.team-box {
    background-color: #f0f8ff; /* Alice Blue */
    border: 1px solid #add8e6; /* Light Blue */
    border-radius: 8px;
    padding: 15px;
    text-align: left;
    min-height: 250px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.team-name-input {
    width: calc(100% - 10px);
    padding: 8px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1.1em;
    font-weight: bold;
    text-align: center;
    background-color: #fff;
}

.team-members {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.team-member-card {
    background-color: #e6f7ff; /* Lighter blue */
    border: 1px solid #cceeff;
    border-radius: 5px;
    padding: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9em;
    color: #333;
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.team-member-card img {
    width: 40px;
    height: 40px;
    image-rendering: pixelated;
}

.team-member-details {
    flex-grow: 1;
}

.team-member-details strong {
    text-transform: capitalize;
    display: block;
    margin-bottom: 3px;
}

.team-member-details small {
    display: block;
    color: #666;
    line-height: 1.3;
}

.remove-pokemon {
    background: none;
    border: none;
    color: #f44336;
    font-size: 1.5em;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
    position: absolute;
    top: 5px;
    right: 5px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.remove-pokemon:hover {
    opacity: 1;
    color: #d32f2f;
}

#start-battle-btn {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    font-size: 1.2em;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    margin-top: 20px;
    width: 100%;
}

#start-battle-btn:hover:not(:disabled) {
    background-color: #218838;
    transform: translateY(-1px);
}

#start-battle-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* Battle Screen */
#battle-screen {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.battle-pokemon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 45%;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.battle-pokemon img {
    width: 120px;
    height: 120px;
    image-rendering: pixelated;
}

.battle-pokemon h3 {
    margin: 0;
    font-size: 1.5em;
    text-transform: capitalize;
}

.battle-pokemon h3 small {
    display: block;
    font-size: 0.6em;
    color: #777;
    margin-top: 5px;
}

.hp-bar-container {
    width: 100%;
    height: 20px;
    background-color: #eee;
    border: 1px solid #ccc;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 5px;
}

.hp-bar {
    height: 100%;
    width: 100%;
    background-color: #28a745; /* Green */
    transition: width 0.5s ease-in-out;
    border-radius: 10px;
}

.hp-bar.low {
    background-color: #ffc107; /* Yellow */
}

.hp-bar.critical {
    background-color: #dc3545; /* Red */
}

#player-hp-text, #cpu-hp-text {
    font-size: 0.9em;
    font-weight: bold;
    color: #555;
}

.battle-arena {
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    width: 100%;
    max-width: 800px;
    margin-bottom: 20px;
    background-color: #e6ffe6;
    border: 2px solid #aaddaa;
    border-radius: 10px;
    padding: 20px;
    box-shadow: inset 0 0 10px rgba(0, 150, 0, 0.2);
    min-height: 250px;
    position: relative;
}

.battle-log {
    background-color: #e9eef2;
    border: 1px solid #cceeff;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    width: 100%;
    max-width: 800px;
    min-height: 100px;
    overflow-y: auto;
    text-align: left;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: #444;
}

.battle-log p {
    margin: 5px 0;
}

.battle-controls {
    background-color: #f0f8ff;
    border: 1px solid #add8e6;
    border-radius: 8px;
    padding: 15px;
    width: 100%;
    max-width: 800px;
    text-align: center;
    margin-bottom: 20px;
}

#player-moves {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

#player-moves button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

#player-moves button:hover {
    background-color: #0056b3;
    transform: translateY(-1px);
}

#player-moves button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* Modal Styles */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1000; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.6); /* Black w/ opacity */
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: #fefefe;
    margin: auto;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    width: 90%;
    max-width: 600px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    top: 10px;
    right: 20px;
    cursor: pointer;
}

.close-button:hover,
.close-button:focus {
    color: black;
    text-decoration: none;
}

.modal-pokemon-info {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    background-color: #e0eaff;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #b0c4de;
}

.modal-pokemon-info img {
    width: 100px;
    height: 100px;
    image-rendering: pixelated;
    background-color: rgba(255,255,255,0.7);
    border-radius: 5px;
    padding: 5px;
}

.modal-stats-preview {
    text-align: left;
    font-size: 0.95em;
    color: #555;
}

.modal-stats-preview p {
    margin: 5px 0;
}

.modal-section {
    margin-bottom: 20px;
    text-align: left;
    padding: 10px;
    border: 1px solid #eee;
    border-radius: 8px;
    background-color: #f9f9f9;
}

.modal-section h3 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #444;
}

.modal-section input[type="number"],
.modal-section input[type="text"],
.modal-section input[type="url"],
.modal-section select {
    width: calc(100% - 16px); /* Adjusted for padding */
    padding: 8px;
    margin-top: 5px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

.modal-section label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}

.modal-section input[type="range"] {
    width: 100%;
    margin-top: 10px;
}

.moves-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    max-height: 200px;
    overflow-y: auto;
    padding-right: 5px; /* for scrollbar */
}

.move-checkbox-item {
    display: flex;
    align-items: center;
    background-color: #e6f7ff;
    border: 1px solid #cceeff;
    border-radius: 5px;
    padding: 8px;
    font-size: 0.9em;
    cursor: pointer;
    transition: background-color 0.2s;
    justify-content: space-between;
}

.move-checkbox-item:hover {
    background-color: #d9efff;
}

.move-checkbox-item input[type="checkbox"] {
    margin-right: 8px;
    transform: scale(1.2);
    flex-shrink: 0;
}

.move-checkbox-item span {
    flex-grow: 1;
}

.move-checkbox-item.selected-move {
    background-color: #aaddaa;
    border-color: #66aa66;
}

.move-selection-feedback {
    color: #dc3545;
    font-weight: bold;
    margin-top: 10px;
    text-align: center;
}

#modal-add-to-team-button,
#create-custom-move-button,
#create-custom-pokemon-button {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    font-size: 1.1em;
    cursor: pointer;
    transition: background-color 0.2s ease;
    width: 100%;
    margin-top: 20px;
}

#modal-add-to-team-button:hover:not(:disabled),
#create-custom-move-button:hover:not(:disabled),
#create-custom-pokemon-button:hover:not(:disabled) {
    background-color: #218838;
}

#modal-add-to-team-button:disabled,
#create-custom-move-button:disabled,
#create-custom-pokemon-button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* Specific styling for the custom stat inputs in modal-section */
.modal-section label input[type="number"] {
    width: auto;
    display: inline-block;
    margin-left: 10px;
    margin-right: 20px;
    max-width: 80px;
}

/* New sprite selection tabs */
.sprite-option-tabs {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    justify-content: center;
}

.sprite-option-tabs label {
    background-color: #eee;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-weight: normal;
    display: flex;
    align-items: center;
    gap: 5px;
    border: 1px solid #ccc;
}

.sprite-option-tabs label:hover {
    background-color: #e0e0e0;
}

.sprite-option-tabs input[type="radio"] {
    margin: 0;
    transform: scale(1.1);
}

.sprite-option-tabs label input[type="radio"]:checked {
    background-color: #d0e7ff;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.3);
}

.sprite-input-container {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-top: 10px;
    background-color: #fcfcfc;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.sprite-input-container label {
    width: 100%;
    margin-bottom: 10px;
}

#custom-pokemon-canvas {
    background-color: #fff;
    border: 1px solid #ccc;
    cursor: crosshair;
    touch-action: none; /* Prevent scrolling on touch */
}

.drawing-controls {
    margin-top: 10px;
}

.drawing-controls button {
    background-color: #f44336;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.2s ease;
}

.drawing-controls button:hover {
    background-color: #d32f2f;
}

.deselect-move-btn {
    background: none;
    border: none;
    color: #f44336;
    font-size: 1.2em;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.2s;
    margin-left: 10px;
    flex-shrink: 0;
}

.deselect-move-btn:hover {
    opacity: 1;
    color: #d32f2f;
}

/* Styles for the selected moves display list */
.selected-moves-display {
    background-color: #f0f0f0;
    border: 1px dashed #ccc;
    padding: 10px;
    min-height: 40px; /* To prevent collapse when empty */
    margin-bottom: 15px;
    border-radius: 5px;
    font-size: 0.9em;
    color: #555;
    text-align: left;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.selected-moves-display .selected-move-tag {
    background-color: #aaddaa;
    color: #333;
    padding: 5px 10px;
    border-radius: 15px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}